package cn.gson.crm.controller;

import cn.gson.crm.model.pojos.Customer;
import cn.gson.crm.model.pojos.MoneyBackPlan;
import cn.gson.crm.model.pojos.RefundRecord;
import cn.gson.crm.model.pojos.Shuliang;
import cn.gson.crm.model.service.RefundRecordService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/RefundRecordContract")
public class RefundRecordController {
    @Autowired
    RefundRecordService refundRecordService;
    @RequestMapping("/ContractMethod")
    @ResponseBody
    //查询当前登录人所有的回款记录
    public Map<String,Object> selectref(HttpSession session, Integer rid, Integer page, Integer size){
        return refundRecordService.selectref(session,rid,page,size);

    };
    @RequestMapping("/ContractMethod2")
    @ResponseBody
    //通过客户id查询所有回款计划未回
    public List<MoneyBackPlan> selecthui(Integer cid){
        return refundRecordService.selecthui(cid);
    };
    @RequestMapping("/ContractMethod3")
    @ResponseBody
    //回款多条件查询
    public Map<String,Object> selectwhere(HttpSession session,Integer rid,  String where, Integer page, Integer size){
        return refundRecordService.selectwhere(session,rid,where,page,size);
    };
    @RequestMapping("/ContractMethod4")
    @ResponseBody
    //时间查询
    public Map<String,Object> selecttime(HttpSession session, Integer rid,  String statr,  String endtime,Integer page, Integer size){
        return refundRecordService.selecttime(session,rid,statr,endtime,page,size);
    };
    @RequestMapping("/ContractMethod5")
    @ResponseBody
    public void  saveref(@RequestBody  RefundRecord refundRecord){
        refundRecordService.saveref(refundRecord);
    }
    @RequestMapping("/ContractMethod6")
    @ResponseBody
    //根据回款计划id查询此记录
    public List<MoneyBackPlan> selectm(Integer mid){
        return refundRecordService.selectm(mid);
    };


    @RequestMapping("/selectrefundRecord")
    @ResponseBody
    public List<Shuliang> selectrefundRecord(){
        return refundRecordService.selectrefundRecord();
    }
}
